#include "header.h"

class Complex
{
	double re,im;
public:
	Complex(double,double);
	Complex(const Complex &);
	~Complex(){};
	void setRe(double);
	void setIm(double);
	double getRe();
	double getIm();
	void sum(const Complex &);
	Complex sum(Complex,Complex);
};

Complex::Complex(double re=0, double im=0)
{
	this->re=re;
	this->im=im;
}

Complex::Complex(const Complex &c)
{
	this->re=c.re;
	this->im=c.im;
}

void Complex::setRe(double re)
{
	this->re=re;
}

void Complex::setIm(double im)
{
	this->im=im;
}

double Complex::getRe()
{
	return this->re;
}

double Complex::getIm()
{
	return this->im;
}

void Complex::sum(const Complex &c)
{
	this->re=this->re+c.re;
	this->im=this->im+c.im;
}


Complex Complex::sum(Complex c1,Complex c2)
{
	Complex s;
	s.im=c1.im+c2.im;
	s.re=c1.re+c2.re;
	return s;
}


int main()
{
	Complex a(3,5),b,c(a),s;
	cout<<"a="<<a.getRe()<<"+"<<a.getIm()<<"i\n";
	cout<<"b="<<b.getRe()<<"+"<<b.getIm()<<"i\n";
	cout<<"c="<<c.getRe()<<"+"<<c.getIm()<<"i\n";
	cout<<"s="<<s.getRe()<<"+"<<s.getIm()<<"i\n";
	b.sum(a);
	c.setRe(2);
	c.setIm(4);
	s=s.sum(b,c);
	cout<<"a="<<a.getRe()<<"+"<<a.getIm()<<"i\n";
	cout<<"b="<<b.getRe()<<"+"<<b.getIm()<<"i\n";
	cout<<"c="<<c.getRe()<<"+"<<c.getIm()<<"i\n";
	cout<<"s="<<s.getRe()<<"+"<<s.getIm()<<"i\n";
	_getch();
	return 0;
}